<template>
	<view class="con">
		<view class="top">
			<view class="go_back" @click="go_back">
				<image src="../../../static/img/back.png" mode=""></image>
			</view>
			<view class="dname">
				文章发表
			</view>
		
		</view>
		<h3>标题</h3>
		<input type="text" name="" v-model="articleTitle" placeholder="请输入标题" id="">
		<h3>正文</h3>
		<jinEdit placeholder="请输入内容" @editOk="editOk" uploadFileUrl="/#"></jinEdit> 
	</view>
</template>

<script>
	import jinEdit from '../../../components/jin-edit/jin-edit.vue';
	export default {
		data() {
			return {
				articleTitle:"",
				articleContent:""
				
			}
		},
		components: {
			jinEdit
		},
		methods: {
			editOk(res){
				console.log(this.articleTitle)
				this.articleContent=res.html
				console.log(this.articleContent)
				uni.request({
					url: 'http://123.157.242.136:8087/backend/article/addArticle',
					data: {
						articleTitle: this.articleTitle,
						articleContent: this.articleContent
					},
					header: {
						'content-type': 'application/json;charset=UTF-8'
					},
					method: 'POST',
					success: (res)=> {
						// console.log(res.data);
						if (res.data.code == 0) {
							uni.showToast({
								title: '发表成功',
								icon: 'none'
							});
							
						}
					}
					
				});
			}
			
		}
	}
</script>

<style>
.top {
		/* border: #ACC3D4 solid 1px; */
		width: 750rpx;
		height: 50px;

		/* margin-bottom: 30rpx; */
		display: flex;
		flex-direction: row;
		background-color: #CCE5ED;
		position: sticky;
		top: 0;
		z-index: 999;
	}

	.go_back {
		/* border: #ACC3D4 solid 1px; */
		width: 25px;
		height: 25px;
		margin: 13px;

	}

	.go_back image {
		width: 100%;
		height: 100%;
	}

	.dname {
		width: 650rpx;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		padding-right: 100rpx;
		box-sizing: border-box;
		font-size: 50rpx;
		font-weight: bolder;

		/* border: red solid 1px; */
	}
</style>
